package com.zbf.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.MultiValueMap;

/**
 * @author: LI-CI-GAO
 * 作者: licigao
 * 日期: 2021/9/10  8:13
 * 描述:
 */
public class MyCondication implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {

        /*conditionContext.getResourceLoader();//资源加载器
        String myIntercepter = conditionContext.getRegistry().getBeanDefinition("myIntercepter").getBeanClassName();
        boolean myIntercepter1 = conditionContext.getRegistry().isBeanNameInUse("myIntercepter");
        System.out.println("============>"+myIntercepter);

        if(myIntercepter!=null){
            return true;
        }*/

        MultiValueMap<String, Object> allAnnotationAttributes = annotatedTypeMetadata.getAllAnnotationAttributes("org.springframework.context.annotation.Conditional");

        return false;
    }
}
